package com.pureut.system.controller;

import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.common.core.web.page.TableDataInfo;
import com.pureut.common.log.annotation.Log;
import com.pureut.common.log.enums.BusinessType;
import com.pureut.common.security.annotation.RequiresPermissions;
import com.pureut.system.domain.dto.SysAuditDoneDto;
import com.pureut.system.domain.vo.SysAuditDoneVo;
import com.pureut.system.service.ISysDaibanService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 审核待办控制层
 * @Param
 * @Date 22-12-09
 * @Author hl
 **/
@RestController
@RequestMapping("/daiban")
public class SysDaibanController extends BaseController {

    @Resource
    private ISysDaibanService sysDaibanService;


    /**
     * 获取审核配置
     */
    @RequiresPermissions("approval:daiban:list")
    @GetMapping("/list")
    public TableDataInfo list(SysAuditDoneVo sysAuditDone)
    {
        startPage();
        List<SysAuditDoneDto> list = sysDaibanService.selectAuditDoneList(sysAuditDone);
        return getDataTable(list);
    }

    /**
     * 新增审核信息
     */
    @RequiresPermissions("material:accessories:add")
    @Log(title = "审核待办", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysAuditDoneVo sysAuditDoneVo) {
        return toAjax(sysDaibanService.insertDaiban(sysAuditDoneVo));
    }


}
